//Wrapper for EE::RendererClass
#pragma once
#include "stdafx.h"

namespace EsenthelNet
{
	public enum class RenderMode {
		RM_SIMPLE     , // simple
		RM_EARLY_Z    , // early z
		RM_SOLID      , // solid
		RM_SOLID_M    , // solid in mirrors/water reflections
		RM_AMBIENT    , // ambient
		RM_OVERLAY    , // overlay mode for rendering semi transparent surfaces onto solid meshes (like bullet holes)
		RM_OUTLINE    , // here you can optionally draw outlines of meshes using 'Mesh::drawOutline'
		RM_BEHIND     , // here you can optionally draw meshes which are behind the visible meshes using 'Mesh::drawBehind'
		RM_FUR        , // fur
		RM_BLEND      , // alpha blending
		RM_SHD_MAP    , // shadow map    , render all shadow casting objects here using 'Mesh::drawShadow'       , if objects will not be rendered in this phase they will not cast shadows
		RM_SHD_STENCIL, // shadow stencil, render all shadow casting objects here using 'Mesh::drawStencilShadow', if objects will not be rendered in this phase they will not cast shadows
		RM_CLOUD      , // clouds
		RM_WATER      , // water surfaces
		RM_PALETTE    , // color palette
		RM_PREPARE    , // render all objects here using 'Mesh::draw', and add all lights to the scene using 'Light*::add'

		RM_SHADER_NUM=RM_SHD_MAP+1,
	};

	public delegate void RenderDelegate();

	public ref class RendererClass {
	public:
		RendererClass() { }
		
		EsenthelNet::RenderMode Get () {
			RENDER_MODE r = Renderer();
			
			return (EsenthelNet::RenderMode)r;
		}
		
		EsenthelNet::RendererClass^ Set (RenderDelegate^ d) {
			//d();
			System::IntPtr p = System::Runtime::InteropServices::Marshal::GetFunctionPointerForDelegate(d);

			Renderer(*static_cast<void(*)()>(p.ToPointer()));
			return this;
		}
		
	};
}